﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.Common;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.Ordens.Communication.Translator
{
	public class EmissorOrdemResponseToModel : BaseTranslator<Model.EmissorOrdem, Bovespa.Cliente.Cliente.EmissorOrdemResponse,
												List<Model.EmissorOrdem>, List<Bovespa.Cliente.Cliente.EmissorOrdemResponse>>
	{
		public override Sinacor.UI.Bovespa.Ordens.Model.EmissorOrdem Translate(Sinacor.UI.Bovespa.Ordens.Communication.Bovespa.Cliente.Cliente.EmissorOrdemResponse from){
			if(from == null){
				return null;
			}
			
			Model.EmissorOrdem to = new Sinacor.UI.Bovespa.Ordens.Model.EmissorOrdem();
			
			to.NomeEmissor = from.NomeEmissor;
			
			return to;
		}
		
		public ModelCollection<Model.EmissorOrdem> Translate(List<Bovespa.Cliente.Cliente.EmissorOrdemResponse> from){
			if(from == null){
				return null;
			}

			ModelCollection<Model.EmissorOrdem> to = new ModelCollection<Sinacor.UI.Bovespa.Ordens.Model.EmissorOrdem>();
			for(int i=0; i<from.Count; i++){
				to.Add(Translate(from[i]));
			}
			return to;
		}
	}
}
